<form class="layui-form"  action="{:url('mp/OutNodeProgress/returnGoods')}"   id="returnGoodsForm" >
    {foreach $list as $key=>$vo }
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:100px;"> 订单：{$vo.client_ordernum}</label>
        <div class="layui-input-inline" >
            <input type="radio" name="after_refund_type_{$vo.id}" value="0" class=" field-is_outgo" lay-verify="required" title="整单退" checked="">
            <div class="layui-unselect layui-form-radio layui-form-radioed">
                <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                <div>整单退</div>
            </div>
            <input type="radio" name="after_refund_type_{$vo.id}" value="1" class=" field-is_outgo" lay-verify="required" title="数量退">
            <div class="layui-unselect layui-form-radio">
                <i class="layui-anim layui-icon"></i>
                <div>数量退</div>
            </div>
        </div>
        <div class="layui-input-inline" style="width: 80px;">
            <input type="text" class=" layui-input" name="after_refund_num_{$vo.id}" style="width:80px;"  value="" autocomplete="off" placeholder="输入件数" lay-verify="number">
        </div>
        <label class="layui-form-label" style="width:60px;">退料原因</label>
        <div class="layui-input-inline" style="min-width: 300px;" >
            <input type="text" class=" layui-input" name="after_refund_reason_{$vo.id}" value="" autocomplete="off" placeholder="输入原因" >
        </div>
    </div>
    {/foreach}
    <div class="layui-inline fr" style="margin: 20px 20px;">
        <input type="hidden"  name="order_id_all" value="{$order_id_all}">
        <input type="hidden"  name="client_ordernum_all" value="{$client_ordernum_all}">
        <button type="button" class="layui-btn layui-btn-normal" id="submitSewingform">确定</button>
        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
    </div>
</form>

{include file="system@block/layui" /}
<script src="__PUBLIC_JS__/jquery.2.1.4.min.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js?v={:config('hisiphp.version')}"></script>
<script type="text/javascript">
    var can_flag={$can_flag};
    layui.use(['table', 'laydate', 'form', 'laytpl','cookie','tool'], function() {
        var $ = layui.jquery;
        var table = layui.table;
        var laydate = layui.laydate;
        var form = layui.form;

        $(document).on('click','#submitSewingform',function(e) {
            e.stopPropagation();
            $.ajax({
                type: "POST",
                url: "{:url('mp/OutNodeProgress/returnGoods')}",
                data: $('#returnGoodsForm').serialize() ,
                dataType:"json",
                success: function(res){
                    if (res.code == 1) {
                        window.parent.location.reload();
                        parent.layer.closeAll();
                    } else {
                        layer.msg(res.msg, {icon: 2,anim: 6});
                    }
                }
            });
            return false;
        });

        if(can_flag==0){
            layer.confirm('订单没全部回货完成，不能退货', {btn: ['确定']}, function(index){
                parent.layui.layer.closeAll();
                layer.close(index);
            });
        }
    });

</script>
